
; TestController must be restarted before any changes in this file will be used.

; Manual is here: https://lygte-info.dk/project/TestControllerConfigDevice%20UK.html

#idString HKJ,DigitalInput,
#name HKJ Digitalinput
#handle DigitalInput
#port comnobaud

#help DigitalInput
#helpurl https://lygte-info.dk/project/DigitalInput%20UK.html

; A list of possible column name with unit and formatter (SI, Time, Int, D0..D6) 
; Format: #value ColumnName Unit Format {Selector}
; Selector is only used when column layout varies with mode, this often require the use of #cmdMode
#value Inputs _ DIGITAL(I1,I2,I3,I4,SW5,SW6,SW7,Out)
#value Pulses_I1 _ Int
#value Pulses_I2 _ Int
#value Pulses_I3 _ Int
#value Pulses_I4 _ Int

; How to poll for data, this is used for table and #values?
; a #askMode, #cmdMode and #prepareSample is used before this is string is used.
; Number of returned values must match number of columns defined with #value
; This is a single line command
#askValues ValuesFix?

; Format of answer: f=float, u=remove trailing letters, x=skip, *=Zero upper case values if this value is 0
;#askValuesReadFormat 

; Accept this delay when reading values (seconds)
#readingDelay 2

; Mode change have a longer delay on reading values (seconds)
#modeChangeDelay 10


; String to ask about actual meter mode, it is mostly used for DMM's
; This is a single line command
;#askMode 


; When one of these commands are used through the command interface a new configuration will be done before using #askMode
; Only one word for each #mayModifyMode
; Specify command without initial colon and in the shortest possible form
;#mayModifyMode 


; Prepare the meter to response to #askValues
;#prepareSample arm:sour imm;:arm:count 1;:trig:sour imm;:trig:count 1;:trig:samp:count 1;init

; Initial commands to meter when establishing connection, used to disable local control
;#initCmd  

; Final command to meter before breaking connection, used to restore local control
#finalCmd off

; Used to turn output off for power supplies, generators and electronic loads
#outputOff off


#interfaceType Relay Input Input:2 Input:3 Input:4
#interface setRelays relays (value)
#interface getRelays relays?
#interface setRelay relay(value?"on":"off") (channel)
#interface getRelay relay? (channel)
#interface readInputs 0
#interface readInput 0
:decodemath: (value>>(channel-1))&1


#cmdSetup buttonsOn Relay
:write: relay(value==1?"On":"Off") 1
:read: relay? 1
Off 0
On 1

#cmdSetup text Auto_output
:read: output?
:write: output
:tip: Press F1 to see full documentation on format. Simple: onInputs/offInputs space means or, ! invert
100

#cmdSetup checkbox Settings
:write: fast
:read: fast?
:tip: When check input 1 is in fast mode the statistic can handle kHz
Fast 0 1

#cmdSetup checkbox Settings
:write: led
:read: led?
:tip: Updating the status led takes some time, this can be significant if very fast response is required on the output.
Led 0 1

#cmdSetup checkbox Settings
:write: debounce
:read: debounce?
:tip: Add debounce to inputs with 30ms time.
Debounce 0 30

#cmdSetup button Reset_statsistic
:write: resetStat
:tip: Zeros all the input pulse counters
